# coding=utf-8
from flask import Flask
from flask_sockets import Sockets

from plant.base.log4py import logger
from plant.base.tools.regexConverter import RegexConverter

app = Flask(__name__)
sockets = Sockets(app)
app.config.from_object('pitopminderconfig')
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
app.url_map.converters['regex'] = RegexConverter

logger.info("配置文件路径 ====> " + app.config["PITOP_CONF"])
logger.info("缓存文件路径 ====> " + app.config["CACHEDATA_JSON"])

from plant.views import pumpctrl, temandhumictrl, hightempctrl, airqualityctrl, barometerctrl, moisturectrl, \
    ipctrl, osoptctrl, statectrl

app.register_blueprint(pumpctrl.pitop)
app.register_blueprint(temandhumictrl.pitop)
app.register_blueprint(hightempctrl.pitop)
app.register_blueprint(airqualityctrl.pitop)
app.register_blueprint(barometerctrl.pitop)
app.register_blueprint(moisturectrl.pitop)
app.register_blueprint(ipctrl.pitop)
app.register_blueprint(statectrl.pitop)
app.register_blueprint(osoptctrl.pitop)
